<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
use Illuminate\Support\Facades\Route;

// 权限路由
Route::post('/auth/login', [App\Http\Controllers\Admin\Auth\Index::class, 'login'])->name('auth.login');
Route::name('auth.')->prefix('auth')->middleware(['auth.check:admin'])->group(function () {
	Route::get('/user', [App\Http\Controllers\Admin\Auth\Index::class, 'user'])->name('user');
	Route::post('/logout', [App\Http\Controllers\Admin\Auth\Index::class, 'logout'])->name('logout');
	Route::post('/refresh', [App\Http\Controllers\Admin\Auth\Index::class, 'refresh'])->name('refresh');

	Route::controller(App\Http\Controllers\Admin\Auth\Users::class)->prefix('users')->name('users.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::put('/uprole', 'uprole')->name('uprole');
		Route::put('/passwd', 'passwd')->name('passwd');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\Auth\Menu::class)->prefix('menu')->name('menu.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::get('/my', 'my')->name('my');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\Auth\Role::class)->prefix('role')->name('role.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::put('/auth', 'auth')->name('auth');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\Auth\Department::class)->prefix('department')->name('department.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
});


// 系统路由配置
Route::name('system.')->prefix('system')->middleware(['auth.check:admin'])->group(function () {
	Route::controller(App\Http\Controllers\Admin\System\Index::class)->prefix('index')->name('index.')->group(function () {
		Route::get('/version', 'version')->name('version');
		Route::get('/info', 'info')->name('info');
		Route::post('/clearcache', 'clearcache')->name('clearcache');
	});
	Route::controller(App\Http\Controllers\Admin\System\File::class)->prefix('file')->name('file.')->group(function () {
		Route::post('/upload', 'upload')->name('upload');
		Route::get('/menu', 'menu')->name('menu');
		Route::get('/list', 'lists')->name('list');
		Route::post('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Log::class)->prefix('log')->name('log.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::get('/my', 'my')->name('my');
		Route::post('/clear', 'clear')->name('clear');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Setting::class)->prefix('setting')->name('setting.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::put('/save', 'save')->name('save');
		Route::delete('/delete', 'delete')->name('delete');
		Route::get('/fields', 'fields')->name('fields');
	});
	Route::controller(App\Http\Controllers\Admin\System\Dict::class)->prefix('dict')->name('dict.')->group(function () {
		Route::get('/all', 'all')->name('all');
		Route::get('/lists', 'lists')->name('lists');
		Route::get('/category', 'category')->name('category');
		Route::post('/addcate', 'addcate')->name('addcate');
		Route::put('/editcate', 'editcate')->name('editcate');
		Route::delete('/deletecate', 'deletecate')->name('deletecate');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Area::class)->prefix('area')->name('area.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Client::class)->prefix('client')->name('client.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Menu::class)->prefix('menu')->name('menu.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Modules::class)->prefix('modules')->name('modules.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});
	Route::controller(App\Http\Controllers\Admin\System\Tasks::class)->prefix('tasks')->name('tasks.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::delete('/delete', 'delete')->name('delete');
	});

	Route::controller(App\Http\Controllers\Admin\System\Crontab::class)->prefix('crontab')->name('crontab.')->group(function () {
		Route::get('/index', 'index')->name('index');
		Route::post('/add', 'add')->name('add');
		Route::put('/edit', 'edit')->name('edit');
		Route::put('/reload', 'reload')->name('reload');
		Route::delete('/delete', 'delete')->name('delete');
	});
});
